home *** CD-ROM | disk | FTP | other *** search
/ PC Open 93 / PC Open 93 CD 2.bin / PDF / webdeveloper / lezione_4 / eliminafoto_risposta.asp < prev    next >
Encoding:
Text File  |  2003-12-03  |  1.1 KB  |  55 lines

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2.  
  3. <html>
  4. <head>
  5.     <title>Gestione foto di Mario Rossi</title>
  6. </head>
  7.  
  8. <body>
  9.  
  10. <h1>Elimina foto</h1>
  11.  
  12. <%
  13.  
  14. Dim sql
  15. Dim conn
  16. Dim i
  17.  
  18. Set conn = Server.CreateObject("ADODB.Connection")
  19. conn.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & server.MapPath("/mdb-database/foto2.mdb")
  20.  
  21. sql = "DELETE FROM Foto WHERE nome = '" & request.QueryString("nome") & "'"
  22.  
  23. on error resume next
  24.  
  25. conn.Execute sql
  26.  
  27. If ConnError(conn) > 0 Then
  28.     response.write "Si Φ verificato un problema con l'eliminazione della foto.<br>"
  29.     response.write "Ritorna all'<a href=""gestione.asp"">elenco delle foto</a>"
  30. Else
  31.     response.write "La foto Φ stata eliminata correttamente<br>"
  32.     response.write "Ritorna all'<a href=""gestione.asp"">elenco delle foto</a>"
  33. End If
  34.  
  35. on error goto 0
  36.  
  37. set conn = nothing
  38.  
  39. Function ConnError(conn)
  40.  
  41.   Dim i
  42.   i = 0
  43.  
  44.   For Each errorObject In conn.Errors
  45.       i = i + 1
  46.     Response.Write "ERRORE: " & errorObject.Description & "<br><br>"
  47.   Next
  48.  
  49.   ConnError = i
  50.  
  51. End Function
  52.  
  53. %>
  54.  
  55.